
export function request(url,data={},method="GET"){
	let cookie = wx.getStorageSync('cookies') || []
	let coken = cookie.filter(item => item.indexOf('MUSIC_U') === 0).toString()
	wx.showLoading({
		title: '拼命加载中',
		mask:true
	})
	return new Promise((resolve,reject) => {
		wx.request({
			url:`https://music-api.heheda.top${url}`,
			data,
			method,
			header:{
				// cookie:coken
				Cookie:"MUSIC_U=0060beedd5e5ad82520e063c0406383984c5bdc0bce819f2636b0af9342392d31e8907c67206e1edd78b6050a17a35e705925a4e6992f61d07c385928f88e8de; Max-Age=1296000; Expires=Sun 16 Jan 2022 09:04:43 GMT; Path=/;; SameSite=None; Secure"
			},
			success:(res) => {
				resolve(res)
				wx.hideLoading({
					fail:()=>{
						console.log('加载失败');
					}
				})
			},
			fail:(err) =>{
				reject(err)
			}
		})
	})

}